<style type="text/css">
    .PicDiv{
        border: 1px solid LightGrey; overflow:hidden; min-height:156px; padding-top:10px; padding-left:10px;
    }
    #payeeID .ui.dropdown.selection{
        width: 290px;
    }
    .label_fl{ float: left; margin-right: 1em; line-height: 32px;}
</style>
<!--内容区开始-->
<div class="cont">
    <!--页面遮罩层-->
    <div>
        <!--二级标题-->
        <div class="position " id="page_title">
            <img alt="位置图标" src="dist/images/position.png"/>风控管理&gt;发票管理
            <a ng-click="openDetail()" ng-hide="$needClientCache" title="打开新窗口查看"><i class="large External icon"></i>
            </a>
        </div>
        <!--查看方式-->
        <div class="mybackground">
            <div class="cont_fr_top">
                <!-- <div class="menus_top">
                    <div class="menus_l">处理状态:</div>
                    <ul id="nav">
                        <li class="selected"><a ng-click="getInvoiceList(4)">全部</a></li>
                        <li><a ng-click="getInvoiceList(1)">邮寄中</a></li>
                        <li><a ng-click="getInvoiceList(2)">邮寄完成</a></li>
                        <li><a ng-click="getInvoiceList(-1)">无效</a></li>
                        <li><a ng-click="getInvoiceList(3)">未处理</a></li> 
                    </ul>-->
                    <div class="cont_fr_btn">
                        <div style="height: 20px;">
                            <div class="fr">
                                <button class="cont_f_btn3" ng-click="showAdd()"><i class="add icon"></i>添加</button>
                            </div>
                        </div>
                    </div>
                <!-- </div> -->
                <div class="menus">
                    <div class="menus_con">
                        <div class="ui form">
                            <div class="four fields">
                                <div class="inline field">
                                    <label>客户名：</label>
                                    <input type="text" ng-model="customer_name" placeholder="客户名/电话/编号" ng-keyup="$event.keyCode == 13 && search()" style="width: 160px">
                                </div>
                                <div class="inline field">
                                    <label>付款人：</label>
                                    <input type="text" ng-model="pay_name" placeholder="付款人" ng-keyup="$event.keyCode == 13 && search()" class="ui left icon input" style="width: 160px">
                                </div>
                                <div class="inline field">
                                    <label>开票时间：</label>
                                    <div class="ui left icon input">
                                        <input id="create_time" ng-model="create_time" placeholder="开票时间" datetimepicker  format='YYYY-MM-DD' ng-keyup="$event.keyCode == 13 && search()" class="ui left icon input" style="width: 160px">
                                        <i class="calendar icon"></i>
                                    </div>
                                </div>
                                <div class="inline field">
                                    <label>结束时间：</label>
                                    <div class="ui left icon input">
                                        <input id="end_time" ng-model="end_time" placeholder="结束时间" datetimepicker  format='YYYY-MM-DD' ng-keyup="$event.keyCode == 13 && search()" class="ui left icon input" style="width: 160px">
                                        <i class="calendar icon"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="fields">
                                <div class="four wide field" style="margin-left: 66px;">
                                    <button class="search_btn" ng-click="search()">查询</button>
                                    <button class="clear_btn" ng-click="invoiceExport()">导出</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="menus_table">
            <table class="ui yellow celled striped table">
                <thead>
                    <tr>
                        <th>客户名</th>
                        <th>票头</th>
                        <th>发票金额(元)</th>
                        <th>开票人</th>
                        <th style="width:15%; min-width:250px">开票时间</th>
                        <th>发票类型</th>
                        <th>邮寄状态</th>
                        <th style="width:15%; min-width:250px">更新时间</th>
                        <th style="text-align: center;">操作</th>
                    </tr>
                </thead>
                <tbody class="parts_show">
                    <tr ng-repeat="vinvoice in invoice_list">
                        <td><!-- {{vinvoice.nickname}} -->
                            <div float_layer customer-id='vinvoice.customer_id' show-name="vinvoice.nickname"></div>
                        </td>
                        <td>{{vinvoice.title}}</td>
                        <td style="text-align:right;padding-right:1em;">{{vinvoice.money}}</td>
                        <td>{{vinvoice.username}}</td>
                        <td>{{vinvoice.create_time}}</td>
                        <td ng-show="vinvoice.type==1">普通发票</td>
                        <td ng-show="vinvoice.type==2">专票</td>
                        <td>{{vinvoice.status_name}}</td>
                        <td>{{vinvoice.update_time}}</td>
                        <td style="text-align: center;"><a ng-if="vinvoice.deliveryStatus=='10'||vinvoice.deliveryStatus=='20'" rel="{{vinvoice.invoice_id}}" ng-click="showEdit()" alt="编辑按钮" title="编辑">编辑</a>
                        <a ng-if="vinvoice.deliveryStatus=='30'||vinvoice.deliveryStatus=='40'||vinvoice.deliveryStatus=='50'" ng-click="showInvoice()" class="btn">查看</a>
                        <!-- <a rel="{{vinvoice.invoice_id}}" ng-click="delInvoice()" alt="删除按钮" title="删除">删除</a> -->
                        </td>
                    </tr>
                </tbody>
                <tbody ng-show="rcode==2">
                    <tr ng-show="!busy">
                        <td colspan="9" style="text-align:center;margin-top:10px" class="null_data">没有找到数据~~~</td>
                    </tr>
                </tbody>
            </table>
            <div ng-if="invoicepage.pageAll >1 && rcode==1" class="ui pagination fr menu" jspagination page-object="invoicepage" page-func="invoiceDataList">
            </div>
        </div>
    </div>
</div>
<!--内容区结束-->

<!-- 添加发票 -->
<div class="ui first modal add">
    <i class="close icon"></i>
    <div class="header_h4">
        添加发票
    </div>
    <div class="content">
        <div class="ui form">
            <form action="#" name="name-check" class="ui fluid form" id="name-check">
                <div class="inline field required" style="line-height: 32px;">
                    <label>综合查询</label>
                    <div class="ui input">
                        <input type="hidden" name="customerid" id="customerid">
                        <angucomplete-alt
                            id="customer_name" placeholder="付款人姓名／客户电话号码" pause="100" name="pay_name" maxlength="12"
                            selected-object="selectCustomers" local-data="CustomerInf" search-fields="pay_name,phone" 
                            title-field="pay_name" minlength="1" input-class="form-control form-control-small"
                            match-class="highlight" input-changed="CustomerChanged" focus-first = 'true'
                            focus-in="focusIn()" focus-out="focusOut()" field-required="true" input-name="pay_name">
                        </angucomplete-alt>
                    </div>     
                </div>
            </form>
            <!-- 客户付款、发票信息存在 -->
            <div class="ui attached message" ng-if="customerVerify == 1">
                <div class="inline fluid fields" ng-show="payrecord_rcode==1">
                    <div class="field" style="width:50%">
                        <label style="margin-left: 0.5em;">付款信息:</label>
                    </div>
                    <div class="field" style="width:50%">
                        <label>付款总金额:</label>
                        <span>{{total_paymount}}元</span>
                    </div>
                </div>
                <div class="ui attached segment">
                    <table class="ui celled striped table">
                        <thead>
                            <tr>
                                <th>
                                    <!-- <input class="check_allAdd" id="check_allAdd" type="checkbox"/> -->
                                </th>
                                <th>业务员</th>
                                <th>订购产品</th>
                                <th>付款人</th>
                                <th>客户名</th>
                                <th>电话号码</th>
                                <th style="width:105px;">付款金额(元)</th>
                                <th>打款时间</th>
                                <th>状态</th>
                                <th>发票情况</th>
                                <th style="width:105px;">开票金额(元)</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr ng-repeat="vpayrecord in payrecordInfo">
                                <td>
                                    <input type="checkbox" class="check_listAdd" name="chbidsAdd" value="{{vpayrecord.pay_id}}" ng-click="getPayInfo()" ng-disabled="vpayrecord.invoiceExist=='1'"/>
                                </td>
                                <td>{{vpayrecord.service_name}}</td>
                                <td>{{vpayrecord.product_name}}</td>
                                <td>{{vpayrecord.pay_name}}</td>
                                <td>{{vpayrecord.customer_name}}</td>
                                <td>{{vpayrecord.phone}}</td>
                                <td style="text-align: right">{{vpayrecord.pay_mount}}</td>
                                <td>{{vpayrecord.pay_time}}</td>
                                <td ng-if="vpayrecord.audit_res=='0'">待审核</td>
                                <td ng-if="vpayrecord.audit_res=='1'">审核成功</td>
                                <td ng-if="vpayrecord.audit_res=='2'">审核失败</td>
                                <td ng-if="vpayrecord.invoiceExist=='1'">已开</td>
                                <td ng-if="vpayrecord.invoiceExist=='0'">未开</td>
                                <td style="text-align: right">{{vpayrecord.invoice_mount}}</td>
                            </tr>
                        </tbody>
                        <tbody ng-show="payrecord_rcode!=1">
                            <tr ng-show="!busy">
                                <td colspan="9" style="text-align:center;margin-top:10px" class="null_data">没有找到数据~~~</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="field">
                    <div id="selectPaysAdd"></div>
                </div>
                <div class="inline fluid fields" ng-show="invoice_rcode==1" style="margin-top:10px;">
                    <div class="field" style="width:50%">
                        <label style="margin-left: 0.5em;">历史发票信息:</label>
                    </div>
                    <div class="field" style="width:50%">
                        <label>发票总金额:</label>
                        <span>{{total_money}}元</span>
                    </div>
                </div>
                <div>
                    <table class="ui celled striped table" ng-show="invoice_rcode==1">
                        <thead>
                            <tr>
                                <th>开票时间</th>
                                <th>发票抬头</th>
                                <th style="width:120px;">发票总金额(元)</th>
                                <th>业务人员</th>
                                <th>发票类型</th>
                                <th>邮寄状态</th>
                            </tr>
                        </thead>
                        <tbody >
                            <tr ng-repeat="vinvoice in invoiceInfo">
                                <td>{{vinvoice.create_time}}</td>
                                <td>{{vinvoice.title}}</td>
                                <td style="text-align: right">{{vinvoice.money}}</td>
                                <td>{{vinvoice.nickname}}</td>
                                <td ng-if="vinvoice.type==1">普通发票</td>
                                <td ng-if="vinvoice.type==2">专票</td>
                                <td ng-if="vinvoice.deliStatus==10">待邮寄</td>
                                <td ng-if="vinvoice.deliStatus==20">确认邮寄</td>
                                <td ng-if="vinvoice.deliStatus==30">邮寄中</td>
                                <td ng-if="vinvoice.deliStatus==40">邮寄完成</td>
                                <td ng-if="vinvoice.deliStatus==50">自取</td>
                            </tr>
                        </tbody>
                        <tbody ng-show="invoice_rcode!=1">
                            <tr ng-show="!busy">
                                <td colspan="6" style="text-align:center;margin-top:10px" class="null_data">没有找到数据~~~</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <!-- 客户付款、发票信息不存在 -->
            <div class="ui attached message" ng-if="customerVerify == 2">
                <div class="inline fluid fields">
                    <div style="text-align:center;margin-top:10px">没有找到给客户相关付款、发票数据，请确认后添加~~~</div>
                </div>
            </div>
            <div class="ui form">
                <div class="inline fields" style="margin-top:15px; margin-left: 0">
                    <div class="field required">
                        <label>请选择发票类型</label>
                    </div>
                    <div class="field">
                        <div class="ui radio checkbox">
                            <input name="frequency1" checked="checked" type="radio" ng-click="switchType(1)">
                            <label>普通发票</label>
                        </div>
                    </div>
                    <div class="field" style="margin-left: 50px;">
                        <div class="ui radio checkbox">
                            <input name="frequency1" type="radio" ng-click="switchType(2)">
                            <label>专票</label>
                        </div>
                    </div>
                </div>
                <div class="field">
                    <div id="selectType"></div>
                </div>
                <!-- 添加普通发票信息  -->
                <div class="type" ng-show="invoicetype == 1" style="min-height: 130px;">
                    <form action="#" name="frm-add" id="frm-add">
                        <div class="fields" style="margin-top:13px;">
                            <div class="seven wide field required">
                                <label class="label_fl">发票抬头</label>
                                <input type="text" name="title" ng-model="add_title" placeholder="请填写发票抬头" style="width:240px" maxlength="50">
                            </div>
                            <div class="one wide field"></div>
                            <div class="inline eight wide field">
                                <label>收款单位</label>
                                <div class="ui selection dropdown" ng-model="payee" style="width:285px;">
                                    <input type="hidden" name="payee">
                                    <i class="dropdown icon"></i>
                                    <div class="default text">请选择收款单位</div>
                                    <div class="menu">
                                        <div class="item" data-value="{{sel.k}}"  ng-repeat="sel in payeetypes">{{sel.v}}</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="three fields">
                            <div class="seven wide field required">
                                <label class="label_fl">开票金额</label>
                                <input type="text" name="money" ng-model="add_money" ng-keyup="setTax()" placeholder="请填写开票金额" style="width:240px">
                            </div>
                            <div class="one wide field"></div>
                            <div class="inline eight wide field" style="line-height: 32px;">
                                <label style="margin-right: 0.5em">税率</label>
                                <span style="margin-left: 0.5em">6%</span>
                                 <label style="margin-left: 6em">税额</label>
                                <span style="margin-left: 0.5em">{{tax}}</span>
                            </div>
                        </div>
                        <div class="field">
                            <div class="field">
                                <label class="label_fl">备注</label>
                                <input type="text" name="remark" placeholder="请填写备注信息" style="width:81%; margin-left: 2.2em" maxlength="100">
                            </div>
                        </div>
                    </form>
                </div>
                <!-- 添加专票信息  -->
                <div class="type" ng-show="invoicetype == 2">
                    <form action="#" name="frm-imgPost" id="frm-imgPost">
                        <div class="ui form" style="min-height: 270px;">
                            <div class="fields" style="margin-top:13px;">
                                <div class="seven wide field required">
                                    <label class="label_fl">发票抬头</label>
                                    <input type="text" name="imgPost_title" ng-model="imgPost_title" placeholder="请填写发票抬头" style="width:240px" maxlength="50">
                                </div>
                                <div class="one wide field"></div>
                                <div class="seven wide field required">
                                    <label class="label_fl">开票金额</label>
                                    <input type="text" name="imgPost_money" ng-model="imgPost_money" ng-keyup="imgPost_tax()" placeholder="请填写开票金额" style="width:240px">
                                </div>
                            </div>
                            <div class="fields">
                                <div class="inline three wide field">
                                    <label>税率</label>
                                    <span style="margin-left: 0.5em">6%</span>
                                </div>
                                <div class="inline three wide field">
                                    <label>税额</label>
                                    <span style="margin-left: 1em">{{imgPost_taxs}}</span>
                                </div>
                            </div>
                            <div class="fields" style="margin-top:10px;">
                                <div class="seven wide field">
                                    <label>提示：最多可以添加6张图片！</label>
                                </div>
                            </div>
                            <div class="inline fluid field PicDiv">
                                <div ng-repeat="img in imgAdd" class="fl" style="margin: 0">
                                    <div class="add_img fl">
                                        <img ng-src="{{img.path}}" width="108px" height="108px"/>
                                        <div class="x_icon" ng-click="delImg()"></div>
                                    </div>
                                </div>
                                <div class="add_btn fl"><img src="dist/images/add.png" width="108px" height="108px" ng-change="addChange(addPic)" ng-model="addPic" ngf-select/></div>
                                <div class="field pt10" style="padding: 10px">
                                    <div class="field">
                                        <label class="label_fl">图片说明</label>
                                        <input type="text" name="pic_alt" ng-model="pic_alt" placeholder="请填写图片内容说明" style="width: calc(100% - 80px)" maxlength="50">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="inline fields" style="margin-top:15px; margin-left: 0">
                    <div class="field required">
                         <label>请选择邮寄情况</label>
                    </div>
                    <div class="field">
                        <div class="ui radio checkbox">
                            <input name="frequency2" checked="checked" type="radio" ng-click="deliveType(1)">
                            <label>发票邮寄</label>
                        </div>
                    </div>
                    <div class="field" style="margin-left: 50px;">
                        <div class="ui radio checkbox">
                            <input name="frequency2" type="radio" ng-click="deliveType(2)">
                            <label>发票自取</label>
                        </div>
                    </div>
                </div>
                <div class="field">
                    <div id="add_sty"></div>
                </div>
                <!-- 添加邮寄信息  -->
                <div class="type" ng-show="delivetype == 1" style="min-height: 120px;">
                    <form action="#" name="delivery-add" id="delivery-add">
                        <input type="hidden" ng-model="delivery_id">
                        <div class="fields" style="margin-top:13px;">
                            <div class="seven wide field required">
                                <label class="label_fl" style="margin-right: 0.4em">收件人</label>
                                <input type="text" name="recipients" ng-model="ssss" style="width:240px;" placeholder="请填写收件人" maxlength="20">
                            </div>
                            <div class="one wide field"></div>
                            <div class="seven wide field">
                                <label class="label_fl">收件地址</label>
                                <input type="text" name="address" ng-model="customer_address" style="width:240px;" placeholder="请填写收件人地址" maxlength="100">
                            </div>
                        </div>
                        <div class="fields">
                            <div class="seven wide field">
                               <label class="label_fl" style="margin-right: 1em">手机号</label>
                                <input type="text" name="phone" style="width:240px;" ng-model="customer_phone" placeholder="请填写收件人手机号">
                            </div>
                            <div class="one wide field"></div>
                            <div class="inline field">
                                <label>创建时间</label>
                                <div class="ui left icon input" style="width:240px;">
                                    <input name="send_time" placeholder="创建时间" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" value="">
                                    <i class="calendar icon"></i>
                                </div>
                            </div>
                        </div>
                        <div class="field">
                            <label class="label_fl">备注</label>
                            <input type="text" name="remark" placeholder="请填写备注信息" style="width:77%; margin-left: 1.8em" maxlength="100">
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="actions" style="text-align: center;">
        <button class="ui green button positive">确定</button>
        <button class="ui grey button negative">取消</button>
    </div>
</div>

<!-- 编辑发票 -->
<div class="ui edit modal">
    <i class="close icon"></i>
    <div class="header_h4">
        修改发票
    </div>
    <div class="content">
        <input type="hidden" ng-model="edit_data.invoice_id">
        <div class="ui form">
            <div class="inline fluid fields" >
                <div class="field required">
                    <label class="fl">付款人：</label>
                    <span>{{invpay_name}}</span>
                </div>
            </div>
            <div class="ui attached message">
                <div class="inline fluid fields">
                    <div class="field" style="width:50%">
                        <label style="margin-left: 0.5em;">付款信息:</label>
                    </div>
                    <div class="field" style="width:50%">
                        <label>付款总金额:</label>
                        <span>{{total_paymount}}元</span>
                    </div>
                </div>
                <div>
                    <table class="ui celled striped table">
                        <thead>
                            <tr>
                                <th></th>
                                <th>业务员</th>
                                <th>订购产品</th>
                                <th>付款人</th>
                                <th>客户名</th>
                                <th>电话号码</th>
                                <th style="width:105px;">付款金额(元)</th>
                                <th>打款时间</th>
                                <th>状态</th>
                                <th>发票情况</th>
                                <th style="width:105px;">开票金额(元)</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr ng-repeat="vpayrecord in payrecordInfo">
                                <td>
                                    <input type="checkbox" class="check_list" name="chbidsEdit" value="{{vpayrecord.pay_id}}" rel=="{{vpayrecord.pay_id}}" ng-click="getPayInfoEdit()" ng-disabled="vpayrecord.invoiceExist=='1'" ng-checked="vpayrecord.check=='1'"/>
                                </td>
                                <td>{{vpayrecord.service_name}}</td>
                                <td>{{vpayrecord.product_name}}</td>
                                <td>{{vpayrecord.pay_name}}</td>
                                <td>{{vpayrecord.customer_name}}</td>
                                <td>{{vpayrecord.phone}}</td>
                                <td style="text-align: right">{{vpayrecord.pay_mount}}</td>
                                <td>{{vpayrecord.pay_time}}</td>
                                <td ng-if="vpayrecord.audit_res=='0'">待审核</td>
                                <td ng-if="vpayrecord.audit_res=='1'">审核成功</td>
                                <td ng-if="vpayrecord.audit_res=='2'">审核失败</td>
                                <td>
                                    <div ng-if="vpayrecord.check=='1'">已开</div>
                                    <div ng-if="!vpayrecord.check">
                                        <div ng-switch="vpayrecord.invoiceExist">
                                            <div ng-switch-when="1">已开</div>
                                            <div ng-switch-when="0">未开</div>
                                        </div>
                                    </div>
                                </td>
                                <td style="text-align: right">{{vpayrecord.invoice_mount}}</td>
                            </tr>
                        </tbody>
                        <tbody ng-show="payrecord_rcode!=1">
                            <tr ng-show="!busy">
                                <td colspan="5" style="text-align:center;margin-top:10px" class="null_data">没有找到数据~~~</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="field">
                    <div id="selectPaysEdit"></div>
                </div>
                <div class="inline fluid fields" ng-show="invoice_rcode==1" style="margin-top:10px;">
                    <div class="field" style="width:50%">
                        <label style="margin-left: 0.5em;">历史发票信息:</label>
                    </div>
                    <div class="field" style="width:50%">
                        <label>发票总金额:</label>
                        <span>{{total_money}}元</span>
                    </div>
                </div>
                <div>
                    <table class="ui celled striped table" ng-show="invoice_rcode==1">
                        <thead>
                            <tr>
                                <th>开票时间</th>
                                <th>发票抬头</th>
                                <th style="width:120px;">发票总金额(元)</th>
                                <th>业务人员</th>
                                <th>发票类型</th>
                                <th>邮寄状态</th>
                            </tr>
                        </thead>
                        <tbody >
                            <tr ng-repeat="vinvoice in invoiceInfo">
                                <td>{{vinvoice.create_time}}</td>
                                <td>{{vinvoice.title}}</td>
                                <td style="text-align: right">{{vinvoice.money}}</td>
                                <td>{{vinvoice.nickname}}</td>
                                <td ng-if="vinvoice.type==1">普通发票</td>
                                <td ng-if="vinvoice.type==2">专票</td>
                                <td ng-if="vinvoice.deliStatus==10">待邮寄</td>
                                <td ng-if="vinvoice.deliStatus==20">确认邮寄</td>
                                <td ng-if="vinvoice.deliStatus==30">邮寄中</td>
                                <td ng-if="vinvoice.deliStatus==40">邮寄完成</td>
                                <td ng-if="vinvoice.deliStatus==50">自取</td>
                            </tr>
                        </tbody>
                        <tbody ng-show="invoice_rcode!=1">
                            <tr ng-show="!busy">
                                <td colspan="4" style="text-align:center;margin-top:10px" class="null_data">没有找到数据~~~</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="ui form">
                <!-- 显示普通发票信息  -->
                <div class="type" ng-show="edit_data_invoicetype == 1" style="min-height: 130px;">
                    <form action="#" name="frm-edit" id="frm-edit">
                        <div class="fields" style="margin-top:13px;">
                            <div class="seven wide field required">
                                <label class="label_fl">发票抬头</label>
                                <input type="text" name="title" ng-model="edit_title" placeholder="请填写发票抬头" style="width:240px" maxlength="50">
                            </div>
                            <div class="one wide field"></div>
                            <div class="inline eight wide field" >
                                <label>收款单位</label>
                                <div class="ui selection dropdown" id="payeeID" style="width:285px;">
                                    <input type="hidden" name="payee" ng-model="payee_Edit">
                                    <i class="dropdown icon"></i>
                                    <div class="default text">请选择收款单位</div>
                                    <div class="menu">
                                        <div class="item" data-value="{{sel.k}}"  ng-repeat="sel in payeetypes">{{sel.v}}</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="fields">
                            <div class="seven wide field required">
                                <label class="label_fl">开票金额</label>
                                <input type="text" name="money" ng-model="edit_money" ng-keyup="setEdit_tax()" placeholder="请填写开票金额" style="width:240px">
                            </div>
                            <div class="one wide field"></div>
                            <div class="inline eight wide field" style="line-height: 32px;">
                                <label style="margin-right: 0.5em">税率</label>
                                <span style="margin-left: 0.5em">6%</span>
                                 <label style="margin-left: 6em">税额</label>
                                <span style="margin-left: 0.5em">{{edit_data.tax}}</span>
                            </div>
                        </div>
                        <div class="field" style="margin-left: 0">  
                            <div class="field">
                                <label class="label_fl">备注</label>
                                <input type="text" name="edit_remark" ng-model="edit_data.inv_remark" placeholder="请填写备注信息" style="width:715px; margin-left: 2.2em" maxlength="100">
                            </div>
                        </div>
                    </form>
                </div>
                <!-- 显示专票信息  -->
                <div class="type" ng-show="edit_data_invoicetype == 2" style="min-height: 270px;">
                    <form action="#" name="frm-editPost" id="frm-editPost">
                        <div class="fields" style="margin-top:13px;">
                            <div class="seven wide field required">
                                <label class="label_fl">发票抬头</label>
                                <input type="text" name="imgPostEdit_title" ng-model="imgPostEdit_title" placeholder="请填写发票抬头" style="width:240px" maxlength="50">
                            </div>
                            <div class="one wide field"></div>
                            <div class="seven wide field required">
                                <label class="label_fl">开票金额</label>
                                <input type="text" name="imgPostEdit_money" ng-model="imgPostEdit_money" ng-model="imgPostEdit_money" ng-keyup="imgPostEdit_tax()" placeholder="请填写开票金额" style="width:240px">
                            </div>
                        </div>
                        <div class="fields">
                            <div class="inline three wide field">
                                <label>税率</label>
                                <span style="margin-left: 0.5em">6%</span>
                            </div>
                            <div class="inline three wide field">
                                <label>税额</label>
                                <span style="margin-left: 1em">{{imgPostEdit_taxs}}</span>
                            </div>
                        </div>
                        <div class="fields" style="margin-top:10px;">
                            <div class="seven wide field">
                                <label>提示：最多可以添加6张图片！</label>
                            </div>
                        </div>
                        <div class="inline fluid field PicDiv">
                            <div ng-repeat="img in imgEdit" class="fl" style="margin: 0">
                                <div class="add_img fl">
                                    <img ng-src="{{img.pic_path}}" width="108" height="108"/>
                                    <div class="x_icon" ng-click="delImg_edit()"></div>
                                </div>
                            </div>
                            <div class="add_btn fl"><img src="dist/images/add.png"/ width="108px" height="108px" ng-change="editChange(editPic)" ng-model="editPic" ngf-select></div>
                            <div class="inline field pt10" style="padding: 10px">
                                <label>图片说明</label>
                                <input type="text" name="edit_pic_alt" ng-model="editPic_alt" placeholder="请填写图片内容说明" style="width: calc(100% - 80px)" maxlength="50">
                            </div>
                        </div>
                    </form>
                </div>
                <!-- 显示邮寄信息  -->
                <div class="fields" style="margin-top:13px;">
                    <div class="seven wide field">
                        <label>发票邮寄情况：</label>
                    </div>
                </div>
                <div class="type" ng-show="delivery_id" style="min-height: 110px; margin-top: 10px;">
                    <form action="#" name="delivery-edit" id="delivery-edit">
                        <div class="fields" style="margin-top:13px;">
                            <div class="seven wide field required">
                                <label class="label_fl" style="margin-right: 0.4em">收件人</label>
                                <input type="text" name="recipients" ng-model="deliveryInfo.nickname" placeholder="请填写收件人" style="width:240px;" maxlength="20">
                            </div>
                            <div class="one wide field"></div>
                            <div class="seven wide field">
                                <label class="label_fl">收件地址</label>
                                <input type="text" name="address" ng-model="deliveryInfo.address" placeholder="请填写收件人地址" style="width:240px;" maxlength="100">
                            </div>
                        </div>
                        <div class="fields">
                            <div class="seven wide field">
                               <label class="label_fl" style="margin-right: 1em">手机号</label>
                                <input type="text" name="phone" ng-model="deliveryInfo.phone" placeholder="请填写收件人手机号" style="width:240px;">
                            </div>
                            <div class="one wide field"></div>
                            <div class="inline field">
                               <label>邮寄时间</label>
                                <div class="ui left icon input" style="width:240px;">
                                    <input name="send_time" ng-model="send_timeEdit" placeholder="邮寄时间" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" value="">
                                    <i class="calendar icon"></i>
                                </div>
                            </div>
                        </div>
                        <div class="field" style="margin-left: 0">
                            <label class="label_fl">备注</label>
                            <input type="text" name="remark" ng-model="deliveryInfo.remark" placeholder="请填写备注" style="width:77%; margin-left: 1.8em" maxlength="100">
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="actions" style="text-align: center;">
        <button class="ui green button positive">确定</button>
        <button class="ui grey button negative">取消</button>
    </div>
</div>

<!-- 查看发票信息 -->
<div class="ui showeInvoice modal">
    <i class="close icon"></i>
    <div class="header_h4">
        查看发票信息
    </div>
    <div class="content">
        <form action="#" name="frm-showeInvoice" id="frm-showeInvoice">
            <input type="hidden" name="invoice_id">
            <div class="ui form">
                <div class="inline fluid fields" >
                    <div class="field" style="width:50%">
                        <b class="fl" style="margin-left: 0.5em;">付款人:</b>
                        <span style="width:50%" id="show_customer_name"></span>
                    </div>
                </div>
                <div class="ui attached segment">
                    <div class="inline fluid fields">
                        <div class="field" style="width:50%">
                            <b style="margin-left: 0.5em;">付款信息:</b>
                        </div>
                        <div class="field" style="width:50%">
                            <b>付款总金额:</b>
                            <span>{{total_paymount}}元</span>
                        </div>
                    </div>
                    <div>
                        <table class="ui celled striped table">
                            <thead>
                                <tr>
                                    <th>业务员</th>
                                    <th>订购产品</th>
                                    <th>付款人</th>
                                    <th>客户名</th>
                                    <th>电话号码</th>
                                    <th style="width:105px;">付款金额(元)</th>
                                    <th>打款时间</th>
                                    <th>状态</th>
                                    <th>发票情况</th>
                                    <th style="width:105px;">开票金额(元)</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr ng-repeat="vpayrecord in payrecordInfo">
                                    <td>{{vpayrecord.service_name}}</td>
                                    <td>{{vpayrecord.product_name}}</td>
                                    <td>{{vpayrecord.pay_name}}</td>
                                    <td>{{vpayrecord.customer_name}}</td>
                                    <td>{{vpayrecord.phone}}</td>
                                    <td style="text-align: right">{{vpayrecord.pay_mount}}</td>
                                    <td>{{vpayrecord.pay_time}}</td>
                                    <td ng-if="vpayrecord.audit_res=='0'">待审核</td>
                                    <td ng-if="vpayrecord.audit_res=='1'">审核成功</td>
                                    <td ng-if="vpayrecord.audit_res=='2'">审核失败</td>
                                    <td>
                                        <div ng-if="vpayrecord.check=='1'">已开</div>
                                        <div ng-if="!vpayrecord.check">
                                            <div ng-switch="vpayrecord.invoiceExist">
                                                <div ng-switch-when="1">已开</div>
                                                <div ng-switch-when="0">未开</div>
                                            </div>
                                        </div>
                                    </td>
                                    <td style="text-align: right">{{vpayrecord.invoice_mount}}</td>
                                </tr>
                            </tbody>
                            <tbody ng-show="payrecord_rcode!=1">
                                <tr ng-show="!busy">
                                    <td colspan="5" style="text-align:center;margin-top:10px" class="null_data">没有找到数据~~~</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="inline fluid fields" ng-show="invoice_rcode==1" style="margin-top:10px;">
                        <div class="field" style="width:50%">
                            <b style="margin-left: 0.5em;">历史发票信息:</b>
                        </div>
                        <div class="field" style="width:50%">
                            <b>发票总金额:</b>
                            <span>{{total_money}}元</span>
                        </div>
                    </div>
                    <div>
                        <table class="ui celled striped table" ng-show="invoice_rcode==1">
                            <thead>
                                <tr>
                                    <th>开票时间</th>
                                    <th>发票抬头</th>
                                    <th style="width:120px;">发票总金额(元)</th>
                                    <th>业务人员</th>
                                    <th>发票类型</th>
                                    <th>邮寄状态</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr ng-repeat="vinvoice in invoiceInfo">
                                    <td>{{vinvoice.create_time}}</td>
                                    <td>{{vinvoice.title}}</td>
                                    <td  style="text-align: right">{{vinvoice.money}}</td>
                                    <td>{{vinvoice.nickname}}</td>
                                    <td ng-if="vinvoice.type==1">普通发票</td>
                                    <td ng-if="vinvoice.type==2">专票</td>
                                    <td ng-if="vinvoice.deliStatus==10">待邮寄</td>
                                    <td ng-if="vinvoice.deliStatus==20">确认邮寄</td>
                                    <td ng-if="vinvoice.deliStatus==30">邮寄中</td>
                                    <td ng-if="vinvoice.deliStatus==40">邮寄完成</td>
                                    <td ng-if="vinvoice.deliStatus==50">自取</td>
                                </tr>
                            </tbody>
                            <tbody ng-show="invoice_rcode!=1">
                                <tr ng-show="!busy">
                                    <td colspan="4" style="text-align:center;margin-top:10px" class="null_data">没有找到数据~~~</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <!--查看普通发票信息-->
                <div class="type" ng-show="invoicetype == 1" style="height: 100px;">
                    <div class="inline fluid fields" style="margin-top:13px;">
                        <div class="field" style="width:50%">
                            <b>发票抬头：</b>
                            <span style="width:50%" id="show_title"></span>
                        </div>
                        <div class="field" style="width:50%" id="payeeID">
                           <b>收款单位：</b>
                           <span style="width:60%" id="show_payee"></span>
                        </div>
                    </div>
                    <div class="inline fluid fields">
                        <div class="field" style="width:50%">
                            <b>开票金额：</b>
                            <span style="width:50%" id="show_money"></span>
                        </div>
                        <div class="fields" style="width: 50%">
                            <div class="inline field">
                                <b style="margin-left: 0.5em">税率：</b>
                                <span>6%</span>
                            </div>
                             <div class="inline field">
                                <b style="margin-left: 2em">税额：</b>
                                <span id="show_tax"></span>
                            </div>
                        </div>
                    </div>
                    <div class="inline fluid fields" >
                        <div class="field" style="width:50%">
                            <b style="margin-right: 3em">备注：</b>
                            <span style="width:50%" id="show_invoi_remark"></span>
                        </div>
                    </div>
                </div>
                <!--查看专票信息-->
                <div class="type" ng-show="invoicetype == 2" style="height: 280px;">
                    <div class="inline fluid fields" style="margin-top:13px;">
                        <div class="field" style="width:50%">
                            <b>发票抬头：</b>
                            <span style="width:50%" id="special_title"></span>
                        </div>
                        <div class="field" style="width:50%">
                            <b>开票金额：</b>
                            <span style="width:50%" id="special_money"></span>
                        </div>
                    </div>
                    <div class="inline fluid fields">
                        <div class="field" style="width:50%">
                            <b>税率：</b>
                            <span style="margin-left:2em;" >6%</span>
                        </div>
                        <div class="field" style="width:50%">
                            <b style="margin-right: 3em">税额：</b>
                            <span style="width:50%" id="special_tax"></span>
                        </div>
                    </div>
                    <div class="inline fluid fields" >
                        <div class="field" style="width:50%" id="statusID">
                           <b>邮寄状态：</b>
                           <span style="width:50%" id="special_invoi_status"></span>
                        </div>
                    </div>
                    <div class="inline fluid fields" >
                        <b>图片信息：</b>
                    </div>
                    <div class="ui segment" style="margin-top: 0">
                         <div class="fields clearfix">
                            <div ng-repeat="img in imgArr" class="fl" style="margin: 0">
                                <div class="add_img fl">
                                    <img ng-src="{{img.pic_path}}" width="108px" height="108px" />
                                </div>
                            </div>
                        </div>
                        <div class="inline field">
                            <b>图片说明：</b>
                            <span id="special_pic_alt"></span>
                        </div>
                    </div>
                </div>
                <div class="type" ng-hide="delivery_id">
                    <div class="inline fluid fields" style="margin-top:5px;">
                        <div class="field" style="width:50%">
                            <b>发票邮寄情况：发票自取</b>
                        </div>
                    </div>
                </div>
                <!--查看邮寄信息-->
                <div class="type" ng-show="delivery_id">
                    <div class="inline fluid fields" style="margin-top:5px;">
                        <div class="field" style="width:50%">
                            <b>发票邮寄情况：</b>
                        </div>
                    </div>
                </div>
                <div class="type" ng-show="delivery_id" style="height: 130px;">
                    <div class="inline fluid fields" style="margin-top:10px;">
                        <div class="field" style="width:50%">
                            <b style="margin-right: 1em;">收件人：</b>
                            <span style="width:50%;margin-left: 1em;" id="show_recipients"></span>
                        </div>
                        <div class="field" style="width:50%">
                            <b>手机号：</b>
                            <span style="width:50%;margin-left: 1em;" id="show_phone"></span>
                        </div>
                    </div>
                    <div class="inline fluid fields">
                        <div class="field" style="width:50%">
                            <b style="margin-right: 1em;">收件地址：</b>
                            <span style="width:50%" id="show_address"></span>
                        </div>
                        <div class="field" style="width:50%">
                            <b>快递公司：</b>
                            <span style="width:50%" id="show_send_way"></span>
                        </div>
                    </div>
                    <div class="inline fluid fields">
                        <div class="field" style="width:50%">
                            <b style="margin-right: 1em;">订单号：</b>
                            <span style="width:50%;margin-left: 1em;" id="show_order_num"></span>
                        </div>
                        <div class="field" style="width:50%">
                            <b>运单号：</b>
                            <span style="width:50%;margin-left: 1em;" id="show_delivery_num"></span>
                        </div>
                    </div>
                    <div class="inline fluid fields">
                        <div class="field" style="width:50%">
                            <b style="margin-right: 1em;">邮寄时间：</b>
                            <span style="width:50%" id="show_send_time"></span>
                        </div>
                        <div class="field" style="width:50%">
                            <b style="margin-right: 1em;">邮寄状态：</b>
                            <span style="width:50%" id="show_status"></span>
                        </div>
                    </div>
                    <div class="inline fluid fields">
                        <div class="field" style="width:50%">
                            <b>备注：</b>
                            <span style="width:50%;margin-left: 2em;" id="show_remark"></span>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div class="actions" style="text-align: center;">
        <button class="ui green button positive">关闭</button>
    </div>
</div>
<!-- 确认是否删除发票 -->
<div class="ui small del modal transition" style="text-align: center;" id="del-model">
    <div class="header">
        删除发票确认
    </div>
    <div class="content">
        <i class="huge red help circle icon"></i>
        <p style="padding-top: 15px;"></p>
    </div>
    <div class="actions">
        <button class="ui green button positive">确定</button>
        <button class="ui grey button negative">取消</button>
    </div>
</div>
<!--添加成功-->
<div class="ui small modal addOk" style="text-align: center;">
    <div class="header">提示</div>
    <div class="content">
        <i class="huge green check circle outline icon"></i>
        <p style="padding-top: 15px;">添加成功</p>
    </div>
</div>
<!--添加失败-->
<div class="ui modal addFail" style="text-align: center;">
    <div class="header">提示</div>
    <div class="content">
        <i class="huge red warning outline icon"></i>
        <p style="padding-top: 15px;">添加失败</p>
    </div>
</div>
<!--图片上传失败-->
<div class="ui modal postFail" style="text-align: center;">
    <div class="header">提示</div>
    <div class="content">
        <i class="huge red warning outline icon"></i>
        <p style="padding-top: 15px;">图片上传失败</p>
    </div>
</div>
<!--编辑成功-->
<div class="ui small modal editOk" style="text-align: center;">
    <div class="header">提示</div>
    <div class="content">
        <i class="huge green check circle outline icon"></i>
        <p style="padding-top: 15px;">编辑成功</p>
    </div>
</div>
<!--编辑失败-->
<div class="ui modal editFail" style="text-align: center;">
    <div class="header">提示</div>
    <div class="content">
        <i class="huge red warning outline icon"></i>
        <p style="padding-top: 15px;">编辑失败</p>
    </div>
</div>
<!--删除成功-->
<div class="ui small modal delOk" style="text-align: center;">
    <div class="header">提示</div>
    <div class="content">
        <i class="huge green check circle outline icon"></i>
        <p style="padding-top: 15px;">删除成功</p>
    </div>
</div>
<!--删除失败-->
<div class="ui modal delFail" style="text-align: center;">
    <div class="header">提示</div>
    <div class="content">
        <i class="huge red warning outline icon"></i>
        <p style="padding-top: 15px;">删除失败</p>
    </div>
</div>
<!-- 系统信息弹出层 -->
<div class="ui small second modal" style="text-align: center">
    <div class="header">系统提示</div>
    <div class="content">
        <i class="green success circle huge icon" ng-show="invoiceRcode==1"></i>
        <i class="red warning circle huge icon" ng-show="invoiceRcode==0"></i>
        <p>{{invoiceMsg}}</p>
    </div>
    <div class="actions">
        <div class="ui button positive">关闭</div>
    </div>
</div>

<script type="text/javascript">
$('.ui.selection.dropdown').dropdown();
$("#nav li").click(function(){
   $(this).addClass('selected').siblings().removeClass('selected');
});
$(function(){
    $.fn.form.settings.rules.checkCustomer = function() {
        var isValid = true;
        var customerid = $('#name-check input[name="customerid"]').val();
        if(customerid == 'false')
            isValid = false;
        else
            isValid = true;
        return isValid;
    };
    //添加普通发票
    $('#frm-add').form({
        on: 'blur',
        inline : true,
        fields: {
            title: {
            identifier: 'title',
            rules: [
                {
                    type   : 'empty',
                    prompt : '发票抬头不能为空'
                }
            ]},
            money:{
            identifier: 'money',
            rules: [
                {
                    type   : 'empty',
                    prompt : '发票金额不能为空'
                },
                {
                    type   : 'number',
                    prompt : '发票金额必须为数字'
                }
            ]},
        }
    });
    //编辑发票
    $('#frm-edit').form({
        on: 'blur',
        inline : true,
        fields: {
            title: {
            identifier: 'title',
            rules: [
                {
                    type   : 'empty',
                    prompt : '发票抬头不能为空'
                }
            ]},
            money:{
            identifier: 'money',
            rules: [
                {
                    type   : 'empty',
                    prompt : '发票金额不能为空'
                },
                {
                    type   : 'number',
                    prompt : '发票金额必须为数字'
                }
            ]},
        }
    });
    //添加发票邮寄记录
    $('#delivery-add').form({
        on: 'blur',
        inline : true,
        fields: {
            recipients: {
            identifier: 'recipients',
            rules: [
                {
                    type   : 'empty',
                    prompt : '收件人不能为空'
                }
            ]},
        }
    });
    //编辑发票邮寄记录
    $('#delivery-edit').form({
        on: 'blur',
        inline : true,
        fields: {
            recipients: {
            identifier: 'recipients',
            rules: [
                {
                    type   : 'empty',
                    prompt : '收件人不能为空'
                }
            ]},
            order_num: {
            identifier: 'order_num',
            rules: [
                {
                    type   : 'empty',
                    prompt : '订单号不能为空'
                }
            ]},
        }
    });
    //添加专票
    $('#frm-imgPost').form({
        on: 'blur',
        inline : true,
        fields: {
            imgPost_title: {
            identifier: 'imgPost_title',
            rules: [
                {
                    type   : 'empty',
                    prompt : '发票抬头不能为空'
                }
            ]},
            imgPost_money:{
            identifier: 'imgPost_money',
            rules: [
                {
                    type   : 'empty',
                    prompt : '发票金额不能为空'
                },
                {
                    type   : 'number',
                    prompt : '发票金额必须为数字'
                }
            ]},
        }
    });
    //编辑专票
    $('#frm-editPost').form({
        on: 'blur',
        inline : true,
        fields: {
            imgPostEdit_title: {
            identifier: 'imgPostEdit_title',
            rules: [
                {
                    type   : 'empty',
                    prompt : '发票抬头不能为空'
                }
            ]},
            imgPostEdit_money:{
            identifier: 'imgPostEdit_money',
            rules: [
                {
                    type   : 'empty',
                    prompt : '发票金额不能为空'
                },
                {
                    type   : 'number',
                    prompt : '发票金额必须为数字'
                }
            ]},
        }
    });
    //添加验证客户名
    $('#name-check').form({
        on: 'blur',
        inline : true,
        fields: {
        customerid: {
            identifier: 'customerid',
            rules: [
                {
                    type   : 'empty',
                    prompt : '客户不能为空'
                },{
                    type   :'checkCustomer',
                    prompt : '客户不存在'
                }
            ]}
        }
    });
    setTimeout(function() {
        registerHiddenBlur('customerid', 'customer_name_value');
    }, 200);
});
function registerHiddenBlur(hiddenID, visibleID) {
    $('#' + visibleID).blur(function() {
        //延时触发blur，目的是让hidden input先于blur被赋值
        setTimeout(function() {
            $('#' + hiddenID).trigger('blur');
        }, 100);
    });
}
</script>
